package com.ftg.learn.springboot.product.controller;

import com.ftg.learn.springboot.product.pojo.product;
import com.ftg.learn.springboot.product.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RequestMapping("product")
@CrossOrigin
@RestController
public class ProductController {

	@Autowired
	ProductService ps;

	//根据品牌id显示商品的全部信息
	@GetMapping("/showall/{bid}")
	public Map<String,Object> showAll(@PathVariable String bid){
		Map<String,Object> map = new HashMap<>();
		List<product> list = ps.showAll(bid);
		map.put("data",list);

		return map;
	}


}
